package sn.gandal.mobile.kalpet.data.entities;

import java.sql.SQLException;
import java.util.List;

import android.content.Context;

public class DatabaseManager {

	static private DatabaseManager instance;

    static public void init(Context ctx) {
        if (null==instance) {
            instance = new DatabaseManager(ctx);
        }
    }

    static public DatabaseManager getInstance() {
        return instance;
    }

    private DatabaseHelper helper;
    private DatabaseManager(Context ctx) {
        helper = new DatabaseHelper(ctx);
    }

    private DatabaseHelper getHelper() {
        return helper;
    }

    public List<Account> getAllAccountLists() {
        List<Account> account = null;
        try {
            account = getHelper().getAccountListDao().queryForAll();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return account;
    }
	
}
